package com.rd.student.jike.class2.xuezhixin.day0731;

public class Work02 {

    // 数组方法二
    public static void main(String[] args) {

        int[] arr = new int[50];
        for(int i = 0;i<50;i++){
            arr[i] = -1;
        }

        for(int i = 0;i<20;i++){
            int subscript = (int)(Math.random() * arr.length);
            if(arr[subscript] != -1){
                i--;
                continue;
            }
            System.out.println((i+1) + "\t" + subscript);
            arr[subscript] = subscript;
        }
    }
}
